package com.wms.controller;

import com.wms.dto.UserLoginDto;
import com.wms.pojo.Result;
import com.wms.pojo.User;
import com.wms.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class LoginController {
    @Autowired
    private UserService userService;

    @PostMapping("/login")
    public Result userLogin(@RequestBody User user){
        UserLoginDto dto = userService.queryUserLogin(user);
        if (dto != null){
            return Result.success(dto);
        }
        return Result.error("登入账号或者密码错误！刘岩是大畜生！");
    }
}
